<?php

if (!defined('BASEPATH'))
	exit('No direct script access allowed');
/*
 * To change this template, choose Tools | Templates
* and open the template in the editor.
*/

/**
 * Description of dashboard
 *
 * @author Subha Sundar Das (subhasundar.das@gmail.com)
 */
class Payment extends MX_Controller {

	 

	function Payment() {
		parent :: __construct();
		$this->load->model(array('admin_member_model','admin_post_model','member/member_model'));

		$this->admin_member_model->check_admin_login();
		$this->template
		->set_layout('default') // application/views/layouts/two_col.php
		->set_theme('admin'); // application/views/layouts/two_col.php
		 
		$this->template->set_partial('nav_bar', 'layouts/nav_bar');
		$this->template->set_partial('side_menu', 'layouts/side_menu');
		$this->template->set_partial('footer','footer/footer');
		 
		 
	}


    function mode(){


                $sql = 'Select * from mode';
                $query = $this->db->query($sql);
                $result = $query->row();

        $data['payment']['info'] = $result;
        $this->template->build('payment/payment',$data);



    }

    function submit(){

        $this->form_validation->set_rules('payment_name','Payment Name','xss_clean');
        $this->form_validation->set_rules('payment_mode','Payment Mode','xss_clean|required');
        
        if($this->form_validation->run() == "TRUE"){

            $post_data = array(

                
                'mode' => $this->input->post('payment_mode'),
            );

            $this->db->update('mode',$post_data);
            $msgs = "<div class='alert alert-info'>Successfully</div>";
            $this->session->set_flashdata('message', $msgs);
            redirect('secure/payment/mode');

        }else{


            $msgs = "<div class='alert alert-danger'>Invalid!</div>";
            $this->session->set_flashdata('message', $msgs);

        }
    }
		
}